 //url的校验
 const validatePass = (rule, value, callback) => {
   let regExp = /[\u4e00-\u9fa5]/;
   let match = /^((ht|f)tps?):\/\/[\w\-]+(\.[\w\-]+)+([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?$/;
   if (value === '') {
     return callback(new Error('请输入正确信息'))
   }
   setTimeout(() => {
     if (regExp.test(value) === true) {
       callback(new Error('亲，请勿输入汉字'));
     } else if (match.test(value) === false) {
       callback(new Error('请输入正确的url格式'));
     } else {
       callback()
     }
   }, 300);
 };
//  const validate = (rule, value, callback) => {
//    if (value[0] == null && value[1] == null) {
//      callback(new Error('请输入活动时间'));
//    } else {
//      callback();
//    }
//  };
 const formRules = { //验证规则
   name: [
      { required: true, message: '请输入活动名称', trigger: 'blur' },
      { min: 0, max: 20, message: '不超过二十个字', trigger: 'blur' },
      { type: 'string', message: '必须为url格式', trigger: 'blur' }
   ],
   imageUrl: [
      { validator: validatePass, trigger: 'blur' }
   ],
   url: [
      { validator: validatePass, trigger: 'blur' }
   ],
   remark: [
      { required: true, message: '请输入活动描述', trigger: 'blur' },
      { min: 0, max: 300, message: '不超过三百个字', trigger: 'blur' }
   ]
  //  dateArr: validate
 };

 const activityStatus = [{
   value: 'WARM_UP',
   label: '预热中'
 }, {
   value: 'STARTING',
   label: '进行中'
 }, {
   value: 'DRAFT',
   label: '已结束'
 }]

 export {
  formRules,
  activityStatus

}
